package com.uzipi.springcloud.eurekaconsumerfeign.controller;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>name：UploadController </p>
 * <p>description: 文件上传 </p>
 *
 * @author uzipi
 * @version v1.0
 * @since
 */

@RestController
public class UploadController {

    /**
     * 文件上传
     * @param file
     * @return
     */
    @PostMapping(value = "/uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public String handleFileUpload(@RequestPart(value = "file") MultipartFile file) {
        System.out.println("文件上传成功:" + file.getName());
        return file.getName();
    }

}
